﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Financial
{
    class ExtensionMethods
    {

        public ExtensionMethods() { }

        public static Quote CreateQuoteFromRow(DataGridViewRow row)
        {
            Quote quote = new Quote();
            quote.Name = (String)row.Cells[0].Value;
            quote.Ask = (String)row.Cells[1].Value;
            quote.Change_And_Percent_Change = (String)row.Cells[2].Value;
            quote.Days_Low = (String)row.Cells[3].Value;
            quote.Days_High = (String)row.Cells[4].Value;
            quote.Fifty_Two_Week_Low = (String)row.Cells[5].Value;
            quote.Fifty_Two_Week_High = (String)row.Cells[6].Value;
            quote.Symbol = (String)row.Cells[7].Value;
            return quote;
            /*
            Quote quote = new Quote();
            quote.Ask = (String)row.Cells[0].Value;
            quote.Average_Daily_Volume = (String)row.Cells[1].Value;
            quote.Bid = (String)row.Cells[2].Value;
            quote.Ask_Real_time = (String)row.Cells[3].Value;
            quote.Bid_Real_time = (String)row.Cells[4].Value;
            quote.Book_Value = (String)row.Cells[5].Value;
            quote.Change_And_Percent_Change = (String)row.Cells[6].Value;
            quote.Change = (String)row.Cells[7].Value;
            quote.Change_Real_time = (String)row.Cells[8].Value;
            quote.DividendShare = (String)row.Cells[9].Value;
            quote.EarningsShare = (String)row.Cells[10].Value;
            quote.EPS_Estimate_Current_Year = (String)row.Cells[11].Value;
            quote.EPS_Estimate_Next_Year = (String)row.Cells[12].Value;
            quote.EPS_Estimate_Next_Quarter = (String)row.Cells[13].Value;
            quote.Days_Low = (String)row.Cells[14].Value;
            quote.Days_High = (String)row.Cells[15].Value;
            quote.Fifty_Two_Week_Low = (String)row.Cells[16].Value;
            quote.Fifty_Two_Week_High = (String)row.Cells[17].Value;
            quote.Fifty_Two_Week_Range = (String)row.Cells[18].Value;
            quote.Open = (String)row.Cells[19].Value;
            quote.Market_Capitalization = (String)row.Cells[20].Value;
            quote.Days_Range = (String)row.Cells[21].Value;
            quote.Previous_Close = (String)row.Cells[22].Value;
            quote.Stock_Exchange = (String)row.Cells[23].Value;
            quote.Volume = (String)row.Cells[24].Value;
            quote.Name = (String)row.Cells[25].Value;
            quote.PE_Ratio = (String)row.Cells[26].Value;
            quote.Symbol = (String)row.Cells[27].Value;
            return quote;
            */
        }
    }
}
